<?php
/**
 * Author: Traveler
 * Time  : 2021/9/8 19:44
 */

namespace app\validate;


use app\ErrorCode;
use think\Validate;

class PasswordValidate extends Validate
{
    /**
     * 验证规则
     *
     * @var string[]
     */
    protected $rule = [
        'oldPassword' => 'require',
//        'newPassword' => 'require|length:5,16',   // 密码使用md5加密，暂不需要验证长度
        'newPassword' => 'require',
        'repPassword' => 'require|confirm:newPassword',
    ];

    /**
     * 提示信息
     *
     * @var string[]
     */
    protected $message = [
        'oldPassword.require' => ErrorCode::REQUIRE_OLD_PASSWORD,
        'newPassword.require' => ErrorCode::REQUIRE_NEW_PASSWORD,
//        'newPassword.length'  => ErrorCode::INVALID_PASSWORD_LEN,
        'repPassword.require' => ErrorCode::REQUIRE_REP_PASSWORD,
        'repPassword.confirm' => ErrorCode::PASSWORD_NOT_CONFIRM,
    ];
}